Skip to content

chore: add watcher for cy-prompt development #31810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 3, 2025

Conversation

ryanthemanuel
Copy link
Collaborator

@ryanthemanuel ryanthemanuel commented Jun 2, 2025

Additional details

Add watcher for cy-prompt development that is enabled when process.env.CYPRESS_LOCAL_CY_PROMPT_PATH is set. This goes along with this PR.

Steps to test

How has the user experience changed?

PR Tasks

@ryanthemanuel ryanthemanuel requested a review from Copilot June 2, 2025 03:23
@ryanthemanuel ryanthemanuel self-assigned this Jun 2, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for a live-reload watcher in the CyPrompt flow when developing against a local cy-prompt path.

  • Refactors ensureCyPromptBundle to always compute its own bundlePath and remove the old local-copy branch
  • Introduces a chokidar watcher in CyPromptLifecycleManager guarded by CYPRESS_LOCAL_CY_PROMPT_PATH
  • Updates unit tests to cover both remote bundle and local watcher scenarios

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/server/test/unit/cloud/cy-prompt/ensure_cy_prompt_bundle_spec.ts Removed local‐path stubs/tests; adjusted copy/readFile stubs
packages/server/test/unit/cloud/cy-prompt/CyPromptLifecycleManager_spec.ts Added tests for watcher setup and listener behavior in local mode
packages/server/lib/cloud/cy-prompt/ensure_cy_prompt_bundle.ts Dropped local-copy logic; derive bundlePath via path.join
packages/server/lib/cloud/cy-prompt/CyPromptLifecycleManager.ts Added hashLoadingMap, integrated chokidar watcher, extracted cloud metadata
packages/server/lib/cloud/StudioLifecycleManager.ts (deleted) Removed outdated Studio lifecycle manager
Comments suppressed due to low confidence (3)

packages/server/lib/cloud/cy-prompt/CyPromptLifecycleManager.ts:19

  • [nitpick] The name hashLoadingMap is ambiguous; consider renaming it to hashLoadingPromises or loadingPromiseByHash for clearer intent.
private static hashLoadingMap: Map<string, Promise<void>> = new Map()

packages/server/test/unit/cloud/cy-prompt/CyPromptLifecycleManager_spec.ts:100

  • Consider adding a test that calls initializeCyPromptManager multiple times with the same cyPromptHash to verify that ensureCyPromptBundle is only invoked once and that subsequent calls reuse the cached promise.
// Add tests for cached bundle loading behavior

packages/server/lib/cloud/cy-prompt/ensure_cy_prompt_bundle.ts:14

  • The code uses path.join but the path module is not imported. Add import path from 'path' at the top of the file to avoid a ReferenceError.
const bundlePath = path.join(cyPromptPath, 'bundle.tar')

Copy link

cypress bot commented Jun 2, 2025

cypress    Run #62861

Run Properties:  status check passed Passed #62861  •  git commit 0cb3e2dad1: Merge branch 'feat/cy-prompt' into ryanm/chore/add-watch-for-cy-prompt
Project cypress
Branch Review ryanm/chore/add-watch-for-cy-prompt
Run status status check passed Passed #62861
Run duration 18m 23s
Commit git commit 0cb3e2dad1: Merge branch 'feat/cy-prompt' into ryanm/chore/add-watch-for-cy-prompt
Committer Ryan Manuel
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 8
Tests that did not run due to a developer annotating a test with .skip  Pending 1232
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 32187
View all changes introduced in this branch ↗︎
UI Coverage  46.11%
  Untested elements 189  
  Tested elements 166  
Accessibility  92.73%
  Failed rules  3 critical   9 serious   2 moderate   2 minor
  Failed elements 698  

@ryanthemanuel ryanthemanuel merged commit e18d31a into feat/cy-prompt Jun 3, 2025
87 of 89 checks passed
@ryanthemanuel ryanthemanuel deleted the ryanm/chore/add-watch-for-cy-prompt branch June 3, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants